<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css"
	media="all">
<link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
		<div class="layuimini-container">
			<div class="layuimini-main">
				<fieldset class="table-search-fieldset">
					<legend>搜索信息</legend>
					<div style="margin: 10px 10px 10px 10px">
						<form class="layui-form layui-form-pane" action="">
							<div class="layui-form-item">
								<div class="layui-inline">
									<!-- <label class="layui-form-label">统计查询</label> -->
									<div class="layui-input-inline">
									<button id="nian" type="button" class="layui-btn layui-btn-sm" lay-filter="demo1">按年统计</button>
										<!-- <select  id="mySelect" style="width: 10">
											<option value="" selected="selected">请选择按年/月/日查询</option>
											<option value="1">按年查询</option>
											<option value="2">按月查询</option>
											<option value="3">按日查询</option>
										</select> -->
									</div>
									<div class="layui-input-inline">
									<button id="yue" type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-filter="demo1">按月统计</button>
									</div>
									<div class="layui-input-inline">
									<button id="ri" type="button" class="layui-btn layui-btn-warm layui-btn-sm" lay-filter="demo1">按日统计</button>
									</div>
									
									<div class="layui-input-inline" id="inputDiv">
										<input id="input1" type="text" class="layui-input">																		
									</div>
								</div>								
								<div class="layui-inline">
									<input id="searchBtn" type="button" value="搜索" class="layui-btn">								
								</div>
							</div>
						</form>
					</div>
				</fieldset>			
			</div>
		</div>

		<table id="statisticsTable" lay-filter="table1"></table>

 		<script src="/lib/layui-v2.6.3/layui.js"></script> 
		
		<script type="text/javascript">
			layui.use([ "table", "layer", "laydate", "form" ], function() {
				var table = layui.table;
				var $ = layui.jquery;
				var layer = layui.layer;
				var laydate = layui.laydate;
				var form = layui.form;
	
				$("body").on("click","#nian",function(){
					$('#input1').val('');
					laydate.render({ 
						  elem: '#input1'
						  ,type: 'year'
						  ,range: '~'
						});
				});
				
				$("body").on("click","#ri",function(){
					$('#input1').val('');
					laydate.render({ 
						  elem: '#input1'
						  ,range: '~'
						});
				});
				
				$("body").on("click","#yue",function(){
					$('#input1').val('');
					laydate.render({ 
						  elem: '#input1'
						  ,type: 'month'
						  ,range: '~'
						});
				});
									
				$("#searchBtn").on("click", function() {
					/* var str=$("#input1").val();
					console.log(str); */
					table.render({
						elem :"#statisticsTable",
						url :"/statistics",
						where : {
							keyword :$("#input1").val(),
							//keyword :"",
							action :"list"
						},
						cols : [ [ {
							title : "商品ID",
							field : "commId",
							sort:"sort"
						}, {
							title : "商品名称",
							field : "commName"
						}, {
							title : "生产厂家",
							field : "commManufacturer"
						}, {
							title : "商品型号",
							field : "commMarking"
						}, {
							title : "商品规格",
							field : "commSpecifications"
						},{
							title : "出入库",
							field : "djCrk"

						}, {
							title : "出/入库数量",
							field : "djQuantity"
						},

						] ],
						page : true,
						limits : [ 5, 10, 15, 20 ]
					});					
				});
				//用代码点了一下搜索
				$("#searchBtn").click();
			});
		</script>
</body>
</html>